package algorithm;

/**
 * @author fangkun
 * @create 2022-05-23-8:53
 *
 * 392
 */
public class Subsequence {
    public static void main(String[] args) {
        boolean subsequence = isSubsequence("abc", "ahbgdc");
        System.out.println(subsequence);
    }

    static boolean isSubsequence(String s,String t){

        int i=0, j=0;

        while (i<s.length() && j<t.length()){

            if (s.charAt(i) == t.charAt(j)){
                i++;
            }
            j++;
        }

        return i == s.length();
    }
}

